package com.example.charstream;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class CharStreamDemo2 {
    public static void main(String[] args) throws IOException {

        /**
         * 字符输入流FileReader
         * 多个字符
         * 字符个数
         */

        //创建对象
        FileReader fr = new FileReader("src/com/example/file/c.txt");

        //读取数据
        char[] chars = new char[2];
        int read = fr.read(chars);
        while (read != -1) {
            System.out.println(new String(chars, 0, read));
            read = fr.read(chars);
        }

        //释放资源
        fr.close();

    }
}
